import { Button, Popconfirm, PopconfirmProps } from "antd";
import { useNavigate } from "react-router-dom";

export function Logout() {
  const navigate = useNavigate();

  const confirm: PopconfirmProps["onConfirm"] = () => {
    navigate('/login');
  };
  const cancel: PopconfirmProps["onCancel"] = () => {
    return;
  };

  return (
    <Popconfirm
      title="即将退出登录"
      description="确定要退出登录吗?这将会返回登录页"
      onConfirm={confirm}
      onCancel={cancel}
      cancelText="否"
      okText="是"
    >
      <Button>退出登录</Button>
    </Popconfirm>
  );
}
